package com.shop2cn.iapi.agentproducts.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.GetDistributorProductSharePicBean;
import com.shop2cn.iapi.agentproducts.service.GetDistributorProductSharePicCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AddAgentProductCallService;
import com.ymttest.utils.AgentUsers;
/**
*分销员分享商品图Test
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetDistributorProductSharePic{
	private static GetDistributorProductSharePicBean getdistributorproductsharepicBean;
	private static GetDistributorProductSharePicCall getdistributorproductsharepicCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("分销员分享商品图Test");
	}

	@Before
	public void caseUp() {
		getdistributorproductsharepicBean=new GetDistributorProductSharePicBean();
		getdistributorproductsharepicCall=new GetDistributorProductSharePicCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getdistributorproductsharepicCall.getOpurl());
	}
	

	// 渠道商
	private static int rootUserId = AgentUsers.rootUserId;
	private static String rootUserName = "NickautoTest";

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetDistributorProductSharePic_001() {
		Logger.start(true,"正确数据，成功");
		try {
			int rootUserId=501150552;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			getdistributorproductsharepicBean.setProductId(productId);
			getdistributorproductsharepicBean.setUserId(rootUserId);
			getdistributorproductsharepicBean.setDistributorId(501150553);
			getdistributorproductsharepicCall.setData(getdistributorproductsharepicBean);
			getdistributorproductsharepicCall.callService();			
			Logger.verifyEquals("200", getdistributorproductsharepicCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}